package org.codeart.facade.controller;

/**
 * 智能管家外观
 */
public class SmartManagerFacade {

    private final Light light;
    
    private final TV tv;
    
    private final AC ac;

    public SmartManagerFacade() {
        this.light = new Light();
        this.tv = new TV();
        this.ac = new AC();
    }
    
    public void say(String command) {
        if (command.contains("open")) {
            on();
        } else if (command.contains("close")) {
            off();
        } else {
            System.out.println("Sorry, can't hear well");
        }
    }

    /**
     * 起床后语音开启，电灯 电视 空调
     */
    private void on() {
        System.out.println("起床了");
        light.on();
        tv.on();
        ac.on();
    }
    
    private void off() {
        System.out.println("睡觉了");
        light.off();
        tv.off();
        ac.off();
    }
}
